<?php
include("../model/configuration.php");
include("../model/function.php");
if(isset($_SESSION['username']) and isset($_SESSION['password'])){

	$query=dbQuery("select username,password,nama_level,nama_pengguna,alamat_pengguna,email_pengguna,telp_pengguna,nama_jenis_identitas,
	no_identitas_pengguna from pengguna,level,jenis_identitas where pengguna.id_level = level.id_level 
	and pengguna.id_jenis_id = jenis_identitas.id_jenis_id order by username")or die(mysql_error());
	
	echo"<tr><td colspan='3'>&nbsp;</td></tr>";
	echo"<tr><td colspan='3'>Pencarian Pengguna</td></tr>";
	echo"<tr><td colspan='3'><hr color='#6d6a69'>&nbsp;</hr></td></tr>";

?>
	<table width="100%" border="1" cellpadding="3" cellspacing="1" align="center">
	<tr align="center">
		<td width="10%">Username</td>
		<td width="10%">Password</td>
		<td width="10%">Level</td>
		<td width="10%">Nama Lengkap</td>
		<td width="10%">Alamat</td>
		<td width="10%">Email</td>
		<td width="10%">Nomor Telepon</td>
		<td width="10%">Jenis ID</td>
		<td width="10%">Nomor Identitas</td>
		<td width="20%" colspan="2">Action</td>
	</tr>
	<?php
	$order=1;
	while($data=dbAssoc($query)){
	?>
	<tr align="center">
		<td width="10%" align="center" ><?php print $data['username']; ?></td>
		<td width="10%" align="center" ><?php print $data['password']; ?></td>
		<td width="10%" align="center" ><?php print $data['nama_level']; ?></td>
		<td width="10%" align="center" ><?php print $data['nama_pengguna']; ?></td>
		<td width="10%" align="center" ><?php print $data['alamat_pengguna']; ?></td>
		<td width="10%" align="center" ><?php print $data['email_pengguna']; ?></td>
		<td width="10%" align="center" ><?php print $data['telp_pengguna']; ?></td>
		<td width="10%" align="center" ><?php print $data['nama_jenis_identitas']; ?></td>
		<td width="10%" align="center" ><?php print $data['no_identitas_pengguna']; ?></td>
		
		<td><a href="user_edit.php?username=<?php print $data['username'];?>">UBAH DATA</a></td>
		<td><a onClick="<?php echo "return confirm('Yakin akan menghapus data $data[username] ?')"; ?>" href="user_delete.php?username=<?php print $data['username'];?>">HAPUS DATA</a></td>
	</tr>
	<?php
	} $order++;
	?>
	<?php
}else{ 
header("Location:../administrator/test.html");
}
?>